<?php
require_once('includes/commons.php');
if ( isSet( $_GET['url'] )){

	get_note_by_url( xnote_escape( $_GET['url']) );
	global $note;
	
	if( empty($note)){
		$note = create_url_note( xnote_escape($_GET['url']) );
		include('themes/'.THEME.'/create.php');
		
	}else if( user_can_edit( $note['url'] ) ){
		include('themes/'.THEME.'/create.php');
		
	}else{
		include('themes/'.THEME.'/view.php');
	}
}else{
	$note = create_unique_note();
	header("Location:".SITE_URL.$note['url']);
}